package com.bjsxt.shop.users.pojo;

import java.util.Date;

import com.alibaba.fastjson.JSONObject;
import com.bjsxt.shop.common.util.DateFormatUtil;

/**
 * 管理员表的pojo
 * @author LXX
 *
 */
public class AAdmins
{
		private int id;
		private int ssoId;
		private String email;
		private String trueName;
		private byte status;
		private Date createTime;
		private Date updateTime;
		private Date lastLoginTime;
		
		/* 辅助字段 */
		private String token ; 

		public int getId()
		{
			return id;
		}

		public void setId(int id)
		{
			this.id = id;
		}

		public int getSsoId()
		{
			return ssoId;
		}

		public void setSsoId(int ssoId)
		{
			this.ssoId = ssoId;
		}

		public String getEmail()
		{
			return email;
		}

		public void setEmail(String email)
		{
			this.email = email;
		}

		public String getTrueName()
		{
			return trueName;
		}

		public void setTrueName(String trueName)
		{
			this.trueName = trueName;
		}

		public byte getStatus()
		{
			return status;
		}

		public void setStatus(byte status)
		{
			this.status = status;
		}

		public Date getCreateTime()
		{
			return createTime;
		}

		public void setCreateTime(Date createTime)
		{
			this.createTime = createTime;
		}

		public Date getUpdateTime()
		{
			return updateTime;
		}

		public void setUpdateTime(Date updateTime)
		{
			this.updateTime = updateTime;
		}

		public Date getLastLoginTime()
		{
			return lastLoginTime;
		}

		public void setLastLoginTime(Date lastLoginTime)
		{
			this.lastLoginTime = lastLoginTime;
		}
		
		public AAdmins parseObject(JSONObject adminsJSON)
		{
			DateFormatUtil dateFormatUtil = new DateFormatUtil(); 
			/*
			adminsJSON.put("id", this.getId());
			adminsJSON.put("email", this.getEmail());
			adminsJSON.put("trueName", this.getTrueName());
			adminsJSON.put("createTime", dateFormatUtil.format(this.getCreateTime()));
			adminsJSON.put("updateTime", dateFormatUtil.format(this.getUpdateTime()));
			adminsJSON.put("lastLoginTime", dateFormatUtil.format(this.getLastLoginTime()));
			 * */
			this.setSsoId(adminsJSON.getIntValue("id"));
			this.setEmail(adminsJSON.getString("email"));
			this.setTrueName(adminsJSON.getString("trueName"));
			this.setToken(adminsJSON.getString("token"));
			/* 将字符串转换成Date */
			/*this.setCreateTime(dateFormatUtil.parse(adminsJSON.getString("createTime")));*/
			this.setUpdateTime(dateFormatUtil.parse(adminsJSON.getString("updateTime")));
			this.setLastLoginTime(dateFormatUtil.parse(adminsJSON.getString("lastLoginTime")));
			return this ; 
		}

		public String getToken()
		{
			return token;
		}

		public void setToken(String token)
		{
			this.token = token;
		}
	}

